/**
 * 
 */
package com.sidom.movieIndexer.factory;

import static com.sidom.movieIndexer.ConstantsForTesting.TEST_RESOURCE_DIRECORY_FILES;

import java.io.File;

import com.sidom.movieIndexer.domain.file.MovieFile;

/**
 * Factory class for creating {@link MovieFile}s.
 * 
 * @author Siebe
 */
public class MovieFileFactory {
	public enum TesMovieFile {
		BOURNE_IDENTITY_CD1, 
		BOURNE_IDENTITY_CD2, 
		BOURNE_IDENTITY_TXT, 
		GONE_IN_60_SECONDS,  
		THE_MATRIX, 
		NO_MOVIE_WITH_THIS_NAME, 
		THE_ISLAND, 
		THE_ITALIAN_JOB, 
		TRANSPORTER, 
		EQUILIBRIUM_CD1, 
		EQUILIBRIUM_CD2, 
		SWORDFISH_CD1, 
		SWORDFISH_CD2,
		YOUTUBE,
		BOX_OFFICE,
		THE_MTRX;
	}
	/**
	 * Create a {@link MovieFile}.
	 * @return The {@link MovieFile} with a null {@link File}.
	 */
	public static MovieFile createMovieFile(){
		return new MovieFile(null);
	}
	
	/**
	 * Create a {@link MovieFile}.
	 * @param cleanedFileName The cleaned file name.
	 * @return The {@link MovieFile} with a null {@link File}.
	 */
	public static MovieFile createMovieFile(String cleanedFileName){
		MovieFile movieFile = createMovieFile();
		movieFile.setCleanedFileName(cleanedFileName);
		return movieFile;
	}
	
	/**
	 * Create a {@link MovieFile}.
	 * @param file The {@link File} on the disk.
	 * @return The {@link MovieFile}.
	 */
	public static MovieFile createMovieFile(File file){
		return new MovieFile(file);
	}
	
	/**
	 * Create a {@link MovieFile}.
	 * @param file The {@link File} on the disk.
	 * @param cleanedFileName The cleaned file name.
	 * @return The {@link MovieFile}.
	 */
	public static MovieFile createMovieFile(File file, String cleanedFileName){
		MovieFile movieFile = createMovieFile(file);
		movieFile.setCleanedFileName(cleanedFileName);
		return movieFile;
	}
	
	/**
	 * Create a {@link MovieFile}.
	 * @param file The {@link File} on the disk.
	 * @return The {@link MovieFile}.
	 */
	public static MovieFile createMovieFile(TesMovieFile tesMovieFile){
		switch (tesMovieFile) {
			case BOURNE_IDENTITY_CD1:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Bourne identity/Bourne identity cd1.avi"), "Bourne identity");
			case BOURNE_IDENTITY_CD2:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Bourne identity/Bourne identity cd2.avi"), "Bourne identity");
			case BOURNE_IDENTITY_TXT:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Bourne identity/Bourne identity.txt"), "Bourne identity");
			case GONE_IN_60_SECONDS:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Gone in 60 seconds/Gone_in_60_seconds DVD.mp4"), "Gone in 60 seconds DVD");
			case THE_MATRIX:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "The Matrix/The matrix.avi"), "The matrix");
			case NO_MOVIE_WITH_THIS_NAME:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "NoMovieWithThisName.avi"), "NoMovieWithThisName");
			case THE_ISLAND:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "The island.mpeg"), "The island");
			case THE_ITALIAN_JOB:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "The italian job XVID.avi"), "The italian job XVID");
			case TRANSPORTER:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Transporter.mp4"), "Transporter");
			case EQUILIBRIUM_CD1:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Equilibrium/CD1/EquilbriumCD1.avi"), "Equilbrium");
			case EQUILIBRIUM_CD2:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Equilibrium/CD2/EquilbriumCD2.avi"), "Equilbrium");
			case SWORDFISH_CD1:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Swordfish/Swordfishcd1.avi"), "Swordfish");
			case SWORDFISH_CD2:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "Swordfish/Swordfishcd2.avi"), "Swordfish");
			case YOUTUBE:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "youtube.avi"), "youtube");
			case BOX_OFFICE:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "box office.avi"), "box office");
			case THE_MTRX:
				return createMovieFile(new File(TEST_RESOURCE_DIRECORY_FILES + "The mtrx.avi"), "The mtrx");
			default:
				return createMovieFile();
		}
	}
}
